﻿using PSAMMatrixCloud.Model;
using System;

namespace PSAMMatrixCloud.TransferSecret
{
    public class PSAMCommon
    {
        public static long NetToJavaTimeStamp(DateTime dateTime)
        {
            return (dateTime.ToUniversalTime().Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000;
        }

        public static DateTime JavaToNetDatetime(long timeStamp)
        {
            long timeTicks = new DateTime(1970, 1, 1).Ticks + 10000000 * timeStamp;

            return new DateTime(timeTicks).AddHours(8);
        }
    }
}